# Maintainer: Balló György <ballogyor+arch at gmail dot com>
# Contributor: AndyRTR <andyrtr@archlinux.org>

pkgname=mythes-hu
pkgver=1.0
pkgrel=3
epoch=1
pkgdesc='Hungarian thesaurus'
arch=('any')
url='https://magyarispell.sourceforge.net/'
license=('GPL')
makedepends=('git' 'libmythes')
optdepends=('libmythes: offers thesaurus library functions')
_commit=2404521a6c320ae5e307c6c0fed31d81de751a88
source=("git+https://git.libreoffice.org/dictionaries#commit=$_commit")
sha256sums=('SKIP')

build() {
  cd dictionaries/hu_HU/
  cat th_hu_HU_v2.dat | th_gen_idx.pl > th_hu_HU_v2.idx
}

package() {
  cd dictionaries/hu_HU/
  install -Dm644 th_hu_HU_v2.dat "$pkgdir/usr/share/mythes/th_hu_HU_v2.dat"
  install -Dm644 th_hu_HU_v2.idx "$pkgdir/usr/share/mythes/th_hu_HU_v2.idx"

  # the symlinks
  install -dm755 "$pkgdir/usr/share/myspell/dicts"
  pushd "$pkgdir/usr/share/myspell/dicts"
    for file in "$pkgdir"/usr/share/mythes/*; do
      ln -sv /usr/share/mythes/$(basename $file) .
    done
  popd

  # docs
  install -Dm644 README_th_hu_HU_v2.txt "$pkgdir/usr/share/doc/$pkgname/README_th_hu_HU_v2.txt"
}
